package com.neuronbit.businessflow.intellij.actions;

import com.intellij.openapi.actionSystem.AnAction;
import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.fileEditor.FileEditor;
import com.intellij.openapi.fileEditor.FileEditorManager;
import com.neuronbit.businessflow.intellij.editor.BpmSwingFileEditor;
import org.jetbrains.annotations.NotNull;

/**
 * The type Go to action.
 */
public class GoToAction extends AnAction {
    @Override
    public void actionPerformed(@NotNull AnActionEvent event) {
        //LangDataKeys.VIRTUAL_FILE_ARRAY.getData(anActionEvent.getDataContext())
        //final PsiFile psiFile = e.getData(LangDataKeys.PSI_FILE);

        if (event.getProject() != null) {
            FileEditor fileEditor = FileEditorManager.getInstance(event.getProject()).getSelectedEditor();
            if (fileEditor == null) {
                return;
            }

            BpmSwingFileEditor editor = (BpmSwingFileEditor) fileEditor;
            editor.goTo();
        }
    }
}
